package com.gshocklab.bulkposter.data.dto;

import android.content.ContentValues;

import com.gshocklab.bulkposter.data.AccountType;
import com.gshocklab.bulkposter.data.DatabaseAdapter;
import com.gshocklab.bulkposter.data.IPersistent;

/**
 * Account DTO
 * @author vitaly gashock
 */

public final class SocialAccount implements IPersistent {
	public int id;
	public String username;
	public String password;
	public AccountType type;
	
	public String accountToken;
	public String secretAccountToken;
	
	public String avatarUrl;
	
	public SocialAccount() {
		this.username = "";
		this.password = "";
		this.accountToken = "";
		this.secretAccountToken = "";
		this.avatarUrl = "";
		
		this.type = new AccountType();
	}
	
	public SocialAccount(String username, String password, AccountType type) {
		this(0, username, password, type);
	}

	public SocialAccount(int id, String username, String password, AccountType type) {
		this.id = id;
		this.username = username;
		this.password = password;
		this.type = type;
	}
	
	@Override
	public ContentValues prepareForPersistance() {
		final ContentValues values = new ContentValues();
		
		values.put(DatabaseAdapter.USERNAME_COLUMN, username);
		values.put(DatabaseAdapter.PASSWORD_COLUMN, password);
		values.put(DatabaseAdapter.ACCOUNT_TYPE_COLUMN, type.accountType);
		values.put(DatabaseAdapter.ACCOUNT_TOKEN_COLUMN, accountToken);
		values.put(DatabaseAdapter.ACCOUNT_SECRET_TOKEN_COLUMN, secretAccountToken);
		values.put(DatabaseAdapter.ACCOUNT_AVATAR_URL_COLUMN, avatarUrl);
		
		return values;
	}
}
